var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var _Math = /** @class */ (function () {
    function _Math() {
    }
    return _Math;
}());
var Departments = /** @class */ (function () {
    function Departments() {
    }
    // 设置课程
    Departments.prototype.SetCourse = function (math) {
        this.mathCourse = math;
    };
    return Departments;
}());
var AdvanceMath = /** @class */ (function (_super) {
    __extends(AdvanceMath, _super);
    function AdvanceMath() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AdvanceMath.prototype.Select = function () {
        console.log('选择了高等数学');
    };
    return AdvanceMath;
}(_Math));
var MathAnalysis = /** @class */ (function (_super) {
    __extends(MathAnalysis, _super);
    function MathAnalysis() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MathAnalysis.prototype.Select = function () {
        console.log('选择数学分析');
    };
    return MathAnalysis;
}(_Math));
// 计算机系
var Computer = /** @class */ (function (_super) {
    __extends(Computer, _super);
    function Computer() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Computer.prototype.Select = function () {
        console.log('计算机系开始选课');
        this.mathCourse.Select();
    };
    return Computer;
}(Departments));
var Mathematics = /** @class */ (function (_super) {
    __extends(Mathematics, _super);
    function Mathematics() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Mathematics.prototype.Select = function () {
        console.log('数学系同学开始选课');
        this.mathCourse.Select();
    };
    return Mathematics;
}(Departments));
// 客户端代码
(function () {
    var dep;
    dep = new Computer();
    dep.SetCourse(new AdvanceMath());
    dep.Select();
    dep = new Mathematics();
    dep.SetCourse(new MathAnalysis());
    dep.Select();
}());
